package com.google.code.sip.ucenter.dao.mongo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.code.sip.core.dao.mongo.GenericMongoDao;
import com.google.code.sip.ucenter.dao.FriendGroupDao;
import com.google.code.sip.ucenter.model.FriendGroup;
import com.google.code.sip.ucenter.model.User;

public class FriendGroupDaoImpl extends GenericMongoDao<FriendGroup, String>
		implements FriendGroupDao {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.google.code.sip.ucenter.dao.mongo.FriendGroupDao#getFriendGroups(com.
	 * google.code.ucenter.model.User)
	 */
	public List<FriendGroup> getFriendGroups(User user) {
		return this.findByProperty("user", user);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.google.code.sip.ucenter.dao.mongo.FriendGroupDao#getDefaultFriendGroup
	 * (com.google.code.sip.ucenter.model.User)
	 */
	public FriendGroup getDefaultFriendGroup(User user) {
		Map<String, Object> properties = new HashMap<String, Object>();
		properties.put("user", user);
		properties.put("defaulted", true);
		return getByProperties(properties);
	}
}
